/**
 * <copyright>
 * </copyright>
 *
 * $Id$
 */
package ch.uzh.ifi.seal.ssqa.model.impl;

import ch.uzh.ifi.seal.ssqa.model.ChangeSet;
import ch.uzh.ifi.seal.ssqa.model.DiffReport;
import ch.uzh.ifi.seal.ssqa.model.ModelPackage;

import java.util.Collection;

import org.eclipse.emf.common.notify.Notification;

import org.eclipse.emf.common.util.EList;

import org.eclipse.emf.ecore.EClass;

import org.eclipse.emf.ecore.impl.ENotificationImpl;
import org.eclipse.emf.ecore.impl.EObjectImpl;

import org.eclipse.emf.ecore.util.EObjectResolvingEList;

/**
 * <!-- begin-user-doc -->
 * An implementation of the model object '<em><b>Diff Report</b></em>'.
 * <!-- end-user-doc -->
 * <p>
 * The following features are implemented:
 * <ul>
 *   <li>{@link ch.uzh.ifi.seal.ssqa.model.impl.DiffReportImpl#getChangeSets <em>Change Sets</em>}</li>
 *   <li>{@link ch.uzh.ifi.seal.ssqa.model.impl.DiffReportImpl#getFirstFile <em>First File</em>}</li>
 *   <li>{@link ch.uzh.ifi.seal.ssqa.model.impl.DiffReportImpl#getSecondFile <em>Second File</em>}</li>
 * </ul>
 * </p>
 *
 * @generated
 */
public class DiffReportImpl extends EObjectImpl implements DiffReport {
	/**
	 * The cached value of the '{@link #getChangeSets() <em>Change Sets</em>}' reference list.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getChangeSets()
	 * @generated
	 * @ordered
	 */
	protected EList<ChangeSet> changeSets;

	/**
	 * The default value of the '{@link #getFirstFile() <em>First File</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getFirstFile()
	 * @generated
	 * @ordered
	 */
	protected static final String FIRST_FILE_EDEFAULT = null;

	/**
	 * The cached value of the '{@link #getFirstFile() <em>First File</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getFirstFile()
	 * @generated
	 * @ordered
	 */
	protected String firstFile = FIRST_FILE_EDEFAULT;

	/**
	 * The default value of the '{@link #getSecondFile() <em>Second File</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getSecondFile()
	 * @generated
	 * @ordered
	 */
	protected static final String SECOND_FILE_EDEFAULT = null;

	/**
	 * The cached value of the '{@link #getSecondFile() <em>Second File</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getSecondFile()
	 * @generated
	 * @ordered
	 */
	protected String secondFile = SECOND_FILE_EDEFAULT;

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	protected DiffReportImpl() {
		super();
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	protected EClass eStaticClass() {
		return ModelPackage.Literals.DIFF_REPORT;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EList<ChangeSet> getChangeSets() {
		if (changeSets == null) {
			changeSets = new EObjectResolvingEList<ChangeSet>(ChangeSet.class, this, ModelPackage.DIFF_REPORT__CHANGE_SETS);
		}
		return changeSets;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public String getFirstFile() {
		return firstFile;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setFirstFile(String newFirstFile) {
		String oldFirstFile = firstFile;
		firstFile = newFirstFile;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, ModelPackage.DIFF_REPORT__FIRST_FILE, oldFirstFile, firstFile));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public String getSecondFile() {
		return secondFile;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setSecondFile(String newSecondFile) {
		String oldSecondFile = secondFile;
		secondFile = newSecondFile;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, ModelPackage.DIFF_REPORT__SECOND_FILE, oldSecondFile, secondFile));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public Object eGet(int featureID, boolean resolve, boolean coreType) {
		switch (featureID) {
			case ModelPackage.DIFF_REPORT__CHANGE_SETS:
				return getChangeSets();
			case ModelPackage.DIFF_REPORT__FIRST_FILE:
				return getFirstFile();
			case ModelPackage.DIFF_REPORT__SECOND_FILE:
				return getSecondFile();
		}
		return super.eGet(featureID, resolve, coreType);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@SuppressWarnings("unchecked")
	@Override
	public void eSet(int featureID, Object newValue) {
		switch (featureID) {
			case ModelPackage.DIFF_REPORT__CHANGE_SETS:
				getChangeSets().clear();
				getChangeSets().addAll((Collection<? extends ChangeSet>)newValue);
				return;
			case ModelPackage.DIFF_REPORT__FIRST_FILE:
				setFirstFile((String)newValue);
				return;
			case ModelPackage.DIFF_REPORT__SECOND_FILE:
				setSecondFile((String)newValue);
				return;
		}
		super.eSet(featureID, newValue);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public void eUnset(int featureID) {
		switch (featureID) {
			case ModelPackage.DIFF_REPORT__CHANGE_SETS:
				getChangeSets().clear();
				return;
			case ModelPackage.DIFF_REPORT__FIRST_FILE:
				setFirstFile(FIRST_FILE_EDEFAULT);
				return;
			case ModelPackage.DIFF_REPORT__SECOND_FILE:
				setSecondFile(SECOND_FILE_EDEFAULT);
				return;
		}
		super.eUnset(featureID);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public boolean eIsSet(int featureID) {
		switch (featureID) {
			case ModelPackage.DIFF_REPORT__CHANGE_SETS:
				return changeSets != null && !changeSets.isEmpty();
			case ModelPackage.DIFF_REPORT__FIRST_FILE:
				return FIRST_FILE_EDEFAULT == null ? firstFile != null : !FIRST_FILE_EDEFAULT.equals(firstFile);
			case ModelPackage.DIFF_REPORT__SECOND_FILE:
				return SECOND_FILE_EDEFAULT == null ? secondFile != null : !SECOND_FILE_EDEFAULT.equals(secondFile);
		}
		return super.eIsSet(featureID);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public String toString() {
		if (eIsProxy()) return super.toString();

		StringBuffer result = new StringBuffer(super.toString());
		result.append(" (firstFile: ");
		result.append(firstFile);
		result.append(", secondFile: ");
		result.append(secondFile);
		result.append(')');
		return result.toString();
	}

} //DiffReportImpl
